
import { Component, createRef } from 'react'

class Son extends Component {

  render () {
    return (
      <div>子组件</div>
    )
  }
}

class Hello extends Component {
  h1 = createRef()

  handleClick = () => {
    console.log(this.h1.current);
  }

  render() {
    return (
      <div>
        <input ref={this.h1} type="text" />
        <button onClick={this.handleClick}>点击</button>
        <hr />
        <Son></Son>
      </div>
    )
  }
}


export default Hello